import Vue from 'vue'
import VueRouter from 'vue-router'
import de from "element-ui/src/locale/lang/de";

Vue.use(VueRouter)


const routes = [
    {
        path: '/',
        redirect: '/login',
        // 遍历路由表的时候隐藏该组件,需要 v-if来控制
        hidden: true,
    },
    {
        path: '/login',
        name: '登录',
        component: resolve => (require(["@/views/Login"], resolve)),
        hidden: true,
        meta: {
            title: '登录'
        },
    }
]

const router = new VueRouter({
    routes,
})

//取消路由重复点击报错push 如果是replace的方式就把push改成replace
const originalPush = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace(location) {
    return originalPush.call(this, location).catch(err => err)
}

// router
export default router
